package com.eh.iteratorAndComposition.base;

import com.eh.iteratorAndComposition.iterator.NoIterator;

import java.util.Iterator;

/**
 * Created by David on 2016/5/1.
 */
public abstract class AbstractMenuItem implements MenuComponent {
    protected String name;
    protected String description;
    protected double price;

    @Override
    public String getName() {
        return name;
    }

    @Override
    public String getDescription() {
        return description;
    }

    @Override
    public double getPrice() {
        return price;
    }

    public void add(MenuComponent menuComponent) {
        throw new UnsupportedOperationException();
    }

    public void remove(MenuComponent menuComponent) {
        throw new UnsupportedOperationException();
    }

    public MenuComponent get(int i) {
        throw new UnsupportedOperationException();
    }

    @Override
    public Iterator<MenuComponent> iterator() {
        return new NoIterator();
    }
}
